package com.cl.photozoom;

import android.app.Activity;
import android.content.Context;

import com.cl.photozoom.ui.ImageEngine;
import com.cl.photozoom.ui.PhotoActivity;

import java.io.Serializable;

/**
 * @Class: PhotoZoomInstance
 * @Description:
 * @Author: ChenLei
 * @Date: 2020/12/23---14:02
 */
public final class PhotoZoomInstance {
    public static ImageEngine mImageEngine;
    public static String savePath;// 保存图片路径
    public static boolean isShowDownload;// 是否显示下载按钮
    private final Context mContext;


    public PhotoZoomInstance isShowDownload(boolean isShowDownload) {
        PhotoZoomInstance.isShowDownload = isShowDownload;
        return this;
    }

    public static PhotoZoomInstance create(Context context) {
        return new PhotoZoomInstance(context);
    }

    public PhotoZoomInstance(Context mContext) {
        this.mContext = mContext;
    }

    public PhotoZoomInstance setSavePath(String savePath) {
        PhotoZoomInstance.savePath = savePath;
        return this;
    }

    public PhotoZoomInstance setImageEngine(ImageEngine imageEngine) {
        if (mImageEngine != imageEngine) {
            mImageEngine = imageEngine;
        }
        return this;
    }

    public void openPreview(int position, Serializable value) {
        PhotoActivity.startPhotoActivity(mContext, position, value);
    }

}
